<template>
    <div>
        <div class="box">
            <input type="id" placeholder="请输入id" v-model="id">
            <input type="text" placeholder="请输入标题" v-model="title">
            <textarea placeholder="请输入内容" v-model="contents"></textarea><br>
            <button @click="adder()">添加</button>
        </div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            id: "",
            title: "",
            contents: ""
        }
    },
    methods: {
        adder() {
            this.$emit("retext", this.id, this.title, this.contents)
            this.id = ""
            this.title = ""
            this.contents = ""
            this.$parent.is = false
        }
    }
}
</script>
<style>
.box {
    width: 250px;
    /* height: 300px; */
    padding: 10px 0 10px;
    border: 1px black solid;
    background-color: #fff;
    position: fixed;
    left: 100px;
    top: 100px;
    text-align: center;
}

button {
    width: 100px;
    height: 50px;
}
</style>